package org.xdemo.example.Utils;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * Created by kz on 2017/8/23.
 */

//全局LISTENER,用来监听启动和结束TOMCAT

public class startupListener implements ServletContextListener {
    /**
     * 关闭操作
     */
    public void contextDestroyed(ServletContextEvent sc) {
        System.out.println("------------------ Tomcat关闭! ------------------");
    }

    /**
     * 启动初始化
     */
    public void contextInitialized(ServletContextEvent sc) {
        //获取application。无法获取request/response/session
        //ServletContext application = sc.getServletContext();
        System.out.println("------------------ Tomcat启动! ------------------");
    }
}
